package com.temp.controller.user;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.temp.entity.Language;
import com.temp.result.Result;
import com.temp.service.LanguageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/language")
@Api(tags = "语言相关接口")
@Slf4j
@Validated
public class LanguageController {

    @Autowired
    private LanguageService languageService;

    @GetMapping("/query")
    @ApiOperation("获取所有的可选择语音")
    public Result getAllLanguage() {
        List<Language> list = languageService.list(Wrappers.<Language>lambdaQuery().eq(Language::getStatus, 1).orderByAsc(Language::getSort));
        return Result.success(list,"apiMsg.querySuccess");
    }

}
